﻿<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>接口请求Demo</title>
</head>
<body>
    <button id="btn">发起请求</button>

    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    <script>
        $('#btn').click(function () {
            $.ajax({
                //配置
                type: "POST",
                url: "aa",
                data: JSON.stringify({ a: '9999999999' }),
                dataType: 'json',//返回数据类型
                contentType: 'application/json',//请求数据类型，默认为application/x-www-form-urlencoded
                async: true,
                beforeSend: function (request) {
                    request.setRequestHeader("abc", "zzz");//设置header
                },
                success: function (returnData) {

                }
            });

        });
    </script>
</body>
</html>
